<template>
  <div>
    <div :class="[{ 'pointer-events-auto': value }]" class="dialog-note">
      <div class="mask"></div>
      <div class="dialog-note-main">
        <div :style="{ background: bg, color: '#FFF' }" class="dialog-head">
          <div class="left"></div>
          <div @click="close" class="right">
            <i style="font-size: 20px" class="el-icon-circle-close"></i>
          </div>
        </div>
        <div class="dialog-note-container">
          <slot></slot>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "WorkspaceJsonDialog",
  mode: {
    event: "input",
    prop: "value",
  },
  props: {
    bg: {
      default: "#FFF",
    },
    value: {
      default: false,
    },
  },
  data() {
    return {};
  },

  mounted() {},

  methods: {
    close() {
      this.$emit("input", false);
    },
  },
};
</script>

<style lang="scss" scoped>
.dialog-note {
  width: 100%;
  height: 100%;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s;

  .mask {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    position: absolute;
    left: 0;
    top: 0;
  }

  .dialog-note-main {
    width: 100%;
    max-width: 600px;
    margin: 0 20px;
    height: 90%;
    background: #fff;
    z-index: 999;
    transition: all 1s;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.07);
    .dialog-head {
      display: flex;
      justify-content: space-between;
      padding: 20px;
    }
    .dialog-note-container {
      flex: 1;
      overflow: hidden;
    }
  }
}

.pointer-events-auto {
  pointer-events: auto;
  opacity: 1;
}
</style>
